package com.cc.bill.controller;
import com.cc.bill.entity.CardPictureEntity;
import com.cc.bill.service.CardPictureService;
import com.cc.common.utils.R;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Arrays;


/**
 * 
 *
 * @author leifengyang
 * @email leifengyang@gmail.com
 * @date 2020-12-11 14:54:41
 */
@RestController
@RequestMapping("card/cardpicture")
@Api(tags = "外出打卡图片")
public class CardPictureController {
    @Autowired
    private CardPictureService cardPictureService;

    /**
     * 信息
     */
    @GetMapping("/info/{id}")
    public R info(@PathVariable("id") Long id){
		CardPictureEntity cardPicture = cardPictureService.getById(id);
        return R.ok().put("cardPicture", cardPicture);
    }

    /**
     * 保存
     */
    @PostMapping("/save")
    public R save(@RequestBody CardPictureEntity cardPicture){
		cardPictureService.save(cardPicture);
        return R.ok();
    }

    /**
     * 修改
     */
    @PostMapping("/update")
    public R update(@RequestBody CardPictureEntity cardPicture){
		cardPictureService.updateById(cardPicture);
        return R.ok();
    }

    /**
     * 删除
     */
    @PostMapping("/delete")
    public R delete(@RequestBody Long[] ids){
		cardPictureService.removeByIds(Arrays.asList(ids));
        return R.ok();
    }

}
